const express = require('express');

const db = require('../db')

const router = express.Router();

// ---------------------------------------------获取汽车详情---------------------------------------------------
router.get('/get_car_details',(req,res)=>{
    const { car_id } = req.query;
    const {user_id} = req.user;
    db(`select *,(select count(1) from collect where  car_id=${car_id} && user_id=${user_id}) as collection from car_info where car_id=${car_id}`,(err,data)=>{
        if (err) {
            throw err;
        }
        res.send({
            code: 1,
            msg: '获取成功！',
            data
        })
    })
})





module.exports = router